using System.Linq;
using Microsoft.Samples.ServiceHosting.StorageClient;

namespace KlearTweet.Web.Storage
{
    public class Setup : KlearStorage.Setup
    {
        public override void CreateTables(StorageAccountInfo ai, string context)
        {
            TableStorage.CreateTablesFromModel(typeof(DataServiceContext), ai);
        }

        public override void FillTables(StorageAccountInfo ai, string context)
        {
        }

        public class DataServiceContext : TableStorageDataServiceContext
        {
            private IQueryable<T> CreateQuery<T>()
            {
                return CreateQuery<T>(typeof(T).Name);
            }

            public IQueryable<Account> Account
            {
                get { return CreateQuery<Account>(); }
            }
        }
    }
}
